use derive_builder::Builder;
use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use crate::{
    error::Error,
    modeling::{
        Class, ComparsionOperator, LogicalOperator, PagingResponse, RelationDirection,
        RelationRelatedType, RelationType, RelationTypeOperator, Value, ValueOperator,
    },
};

use crate::database::DataSource;

#[derive(Debug, Default, Serialize, Deserialize, Clone, Builder, PartialEq)]
#[builder(name = "AttributeConditionBuilder")]
#[builder(pattern = "mutable")]
#[builder(setter(into, strip_option), default)]
#[builder(derive(Debug))]
#[builder(build_fn(error = "Error"))]
pub struct AttributeCondition {
    pub name: String,
    pub operator: ComparsionOperator,
    pub value: String,
    pub values: Option<Vec<String>>,
}

impl AttributeCondition {
    pub fn new_with_equal(name: String, value: String) -> Self {
        Self {
            name,
            operator: ComparsionOperator::Equal,
            value,
            values: None,
        }
    }
    pub fn new(name: String, operator: ComparsionOperator, value: String) -> Self {
        Self {
            name,
            operator,
            value,
            values: None,
        }
    }
}